package com.power.sifa.approve.model;


import com.aventrix.jnanoid.jnanoid.NanoIdUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import com.power.sifa.approve.model.enumeration.Tp_lictype;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  文书云签章配置实体类
*/

@Entity
@ApiModel(value="文书云签章配置")
@Data
@Table(name="Cloud_sign_config",schema="sfapprove")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = false)
//@IdClass(Cloud_sign_config.Cloud_sign_configPK.class) 用于复合组件
public class Cloud_sign_config extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_cloud_sign_config")
    @SequenceGenerator(name = "seq_cloud_sign_config", sequenceName = "SEQ_CLOUD_SIGN_CONFIG", allocationSize = 1)
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "文书类型")
    private String lictypeid;

    @ApiModelProperty(value = "联号")
    private Integer pageindex;

    @ApiModelProperty(value = "印章编码")
    private String sealcode;

    @ApiModelProperty(value = "定位类型（1：坐标，2：文字）")
    private Integer postype;

    @ApiModelProperty(value = "印章坐标（盖章页）")
    private String posxy;

    @ApiModelProperty(value = "印章锚定文字")
    private String postext;

    @ApiModelProperty(value = "盖章页码（0表示全部页都盖章）")
    private Integer pospage;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("lictypeid", this.getLictypeid());
        map.put("pageindex", this.getPageindex());
        map.put("sealcode", this.getSealcode());
        map.put("postype", this.getPostype());
        map.put("posxy", this.getPosxy());
        map.put("postext", this.getPostext());
        map.put("pospage", this.getPospage());
        return map;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (Integer) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Cloud_sign_configPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (Integer)key;

        //Cloud_sign_configPK pk = (Cloud_sign_configPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

    /**
     * 创建行政复议盖章对象
     * @return
     */
    public Cloud_sign_config buildAdmreConfig(String applyid) {
        Cloud_sign_config configObj = Cloud_sign_config.builder()
                .lictypeid(Tp_lictype.ADMRE).pageindex(0)
                .sealcode(Tp_lictype.ADMRECODE).postype(2)
                .postext("（用印）")
                .pospage(0).build();
        return configObj;
    }


}
